from . import bp_product_app
from db_connect import ConnMysqlSlave
from db_connect import ConnMysql
import aiomysql
from .methods import Product
from sanic import response

@bp_product_app.route('/product_insert',methods=['POST'])

async def add_product_info(request):

    app_info = request.form

    product_name = app_info.get('product_name')
    product_price = app_info.get('product_price')
    product_image = request.files.get("product_image")
    product_type_id = app_info.get('product_type_id')

    result = await Product(product_name, product_price, product_image, product_type_id).result()

    return response.json(result)